# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Michael Ekstrand <md@ekstrandom.net>
pkgname=librespot
pkgver=0.4.1
pkgrel=0
pkgdesc="Open Source Spotify client library"
url="https://github.com/librespot-org/librespot"
arch="all !s390x !riscv64" # limited by cargo
license="MIT"
options="!check" # no test suite
makedepends="cargo>=1.53 alsa-lib-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="librespot-$pkgver.tar.gz::https://github.com/librespot-org/librespot/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	"

build() {
	export CARGO_HOME="$srcdir"/cargo
	export RUSTFLAGS="-C target-feature=-crt-static"
	cargo build \
		--release \
		--features alsa-backend \
		--verbose
}

package() {
	install -Dm755 target/release/librespot "$pkgdir"/usr/bin/librespot
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
63ecff22e850a70c0370d3d0a2188f3ba793f869bab56267bf97265382c1bbd556bc8bb01750bbf8143902b15f5903d731b9846d1dae1f6661c84d3724a4d9d2  librespot-0.4.1.tar.gz
c48ea30e2bd076691a2f1e0e3f6c6329921a8cf25e4f39ca82e07aca5a1c2c519007f081f2b6bbd1566086407a52dce787450b840e8a07e3010227cefda0452a  librespot.initd
4286a3d1cc9678af2f43074c30a0ab7a9f686301468a0fd435d37a62773f0d1501b7201851bef4237324a83361ad93531ceb512a42ee0a63d4d14677760f5ec5  librespot.confd
"
